<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="utf-8">
    <title>定时任务执行日志</title>
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
    <link rel="stylesheet" th:href="@{/lib/layui/css/layui.css}" media="all">
    <link rel="stylesheet" th:href="@{/css/public.css}" media="all">
</head>
<body>
<div class="layuimini-container">
    <div class="layuimini-main">
        <input type="hidden" name="jobId" th:value="${jobId}">
        <table class="layui-hide" id="currentTableId" lay-filter="currentTableFilter"></table>

        <script type="text/html" id="statusTpl">
            {{#  if(d.status == 0){ }}
            <span class="layui-badge layui-bg-blue">执行成功</span>
            {{#  } else { }}
            <span class="layui-badge layui-bg-orange">执行失败</span>
            {{#  } }}
        </script>

    </div>
</div>
<script th:src="@{/lib/jquery-3.4.1/jquery-3.4.1.min.js}" charset="utf-8"></script>
<script th:src="@{/lib/layui/layui.js}" charset="utf-8"></script>
<script th:src="@{/lib/coco-message/coco-message.js}" charset="utf-8"></script>
<script th:src="@{/js/lay-config.js}" charset="utf-8"></script>
<script type="text/javascript" th:inline="javascript">
    AjaxUtil.ctx = /*[[@{/}]]*/'';
    layui.use(['form', 'table'], function () {
        var form = layui.form,
            table = layui.table;

        var jobId = $('input[name="jobId"]').val();

        var currTable = table.render({
            elem: '#currentTableId',
            url: AjaxUtil.ctx + 'joblog/list',
            method: 'post', //如果无需自定义HTTP类型，可不加该参数
            where: {'jobId': jobId}, // 初始化时带的参数
            cols: [
                [
                    {
                        field: '', width: '5%', title: '序号', type: 'numbers', align: 'center', templet: function (d) {
                            return d.LAY_TABLE_INDEX + 1;
                        }
                    },
                    {field: 'createTime', width: '15%', title: '执行时间', align: 'center'},
                    {field: 'jobName', width: '10%', title: '任务名称', align: 'center'},
                    {field: 'jobGroup', width: '10%', title: '任务组名', align: 'center'},
                    {field: 'invokeTarget', width: '15%', title: '调用目标字符串', align: 'center'},
                    {field: 'jobMessage', width: '15%', title: '日志信息', align: "left"},
                    {field: 'status', width: '15%', title: '执行结果', align: "center", templet: '#statusTpl',},
                    {field: 'exceptionInfo', width: '15%', title: '异常信息', align: 'center'},
                ]
            ],
            skin: 'line', // 行边框风格
            parseData: function (res) { //res 即为原始返回的数据
                return {
                    "code": res.code, //解析接口状态
                    "msg": res.message, //解析提示文本
                    "count": res.data.total, //解析数据长度
                    "data": res.data.rows //解析数据列表
                };
            }
        });
    });

</script>

</body>
</html>